# Contributor: Krassy Boykinov <kboykinov@teamcentrixx.com>
# Maintainer: Krystian Chachuła <krystian@krystianch.com>
pkgname=plantuml
pkgver=1.2023.12
pkgrel=0
pkgdesc="Draw UML diagrams, using a simple and human readable text description"
url="https://plantuml.com/"
# aarch64: gradle segfaults jvm: https://github.com/plantuml/plantuml/issues/1543
# riscv64: blocked by java-jre
# ppc64le: build times out
arch="noarch !aarch64 !riscv64 !ppc64le"
license="GPL-3.0-or-later"
depends="
	busybox
	graphviz
	gtk+2.0
	java-common
	java-jre
	"
makedepends="
	font-dejavu
	java-jdk
	"
source="
	$pkgname-$pkgver.tar.gz::https://github.com/plantuml/plantuml/archive/refs/tags/v$pkgver.tar.gz
	plantuml.run
	"

# secfixes
#   1.2023.10:
#     - CVE-2023-3431
#     - CVE-2023-3432

build() {
	# exclude lesser functional versions with different license
	sed -e "/include/d" -i settings.gradle.kts
	export GRADLE_USER_HOME="$srcdir"/.gradle
	./gradlew --no-daemon --parallel --stacktrace assemble
}

check() {
	# gradle test (will be seperate call with gradle v9)
	./gradlew --no-daemon --parallel --stacktrace check
}

package() {
	install -Dm644 ./build/libs/plantuml-$pkgver.jar \
		"$pkgdir/usr/share/java/plantuml.jar"
	install -Dm755 "$srcdir/plantuml.run" \
		"$pkgdir/usr/bin/plantuml"
}

sha512sums="
1488ce21873ce1599bc71b0b53d56eb22dda1f4e588675ed5171bb2f46e6fdccb37a0460b46f5cd7a37b19f7b7a1d3f5218ce1364ba106579d28c50f2409d9d1  plantuml-1.2023.12.tar.gz
4b2be5783dffd9aeb4e49c4c192f24e182cc55e39dae45a34f7cf42a0174c22aa0ada60230d6714e473f316ec230d0abec09cfdbeae27e3de0f26861a9814f8e  plantuml.run
"
